<html>
<head><meta charset="utf-8"><title>Problems with issue clippy#6467 (PR: clippy#6681) · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html">Problems with issue clippy#6467 (PR: clippy#6681)</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="225337506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225337506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225337506">(Feb 05 2021 at 18:28)</a>:</h4>
<p>Drafting a PR would probably be helpful to focus the discussion on the lint. You can post the link there and I'll switch over <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="225337702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225337702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225337702">(Feb 05 2021 at 18:29)</a>:</h4>
<p>I've expanded a simple if chain and there is no direct reason why this would trigger your lint as it is a simple if statement at the start. The question would be if you implemented the statement filter like <span class="user-mention silent" data-user-id="264664">flip1995</span>  recommended:</p>
<p><span class="user-mention silent" data-user-id="264664">flip1995</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467/near/225300066">said</a>:</p>
<blockquote>
<p>A hint for further development of this lint: You don't want to lint if a "block-like" expression is the last expression in a block (i.e. if/match/loop expressions)</p>
</blockquote>



<a name="225343294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225343294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bastian <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225343294">(Feb 05 2021 at 19:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="369415">xFrednet</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467/near/225337506">said</a>:</p>
<blockquote>
<p>Drafting a PR would probably be helpful to focus the discussion on the lint. You can post the link there and I'll switch over <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>
</blockquote>
<p>Alright!</p>



<a name="225343649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225343649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bastian <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225343649">(Feb 05 2021 at 19:18)</a>:</h4>
<p><span class="user-mention silent" data-user-id="369415">xFrednet</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467/near/225337702">said</a>:</p>
<blockquote>
<p>I've expanded a simple if chain and there is no direct reason why this would trigger your lint as it is a simple if statement at the start. The question would be if you implemented the statement filter like <span class="user-mention silent" data-user-id="264664">flip1995</span>  recommended:</p>
<p><span class="user-mention silent" data-user-id="264664">flip1995</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467/near/225300066">said</a>:</p>
<blockquote>
<p>A hint for further development of this lint: You don't want to lint if a "block-like" expression is the last expression in a block (i.e. if/match/loop expressions)<br>
</p>
</blockquote>
</blockquote>
<p>Ah I meant the lint gets triggered in the right way! But the actual clippy codebase not always terminates the statements with a <code>;</code>.  Looking at clippy the last statement of a block is often an <code>if_chain!</code> or a <code>span_lint_and[...]()</code> statement.</p>



<a name="225344049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225344049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225344049">(Feb 05 2021 at 19:21)</a>:</h4>
<p>Okay, this was probably also the main reason why <span class="user-mention silent" data-user-id="264664">flip1995</span> recommended to have it as a <code>pedantic</code> lint to enable it by default. We might have to think about enabling it for clippy completely. I would be interested in the extend of the lint triggeres in the PR <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="225344559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225344559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bastian <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225344559">(Feb 05 2021 at 19:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="369415">xFrednet</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467/near/225344049">said</a>:</p>
<blockquote>
<p>Okay, this was probably also the main reason why <span class="user-mention silent" data-user-id="264664">flip1995</span> recommended to have it as a <code>pedantic</code> lint to enable it by default. We might have to think about enabling it for clippy completely. I would be interested in the extend of the lint triggeres in the PR <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>
</blockquote>
<p>Okay I see, I'll open the pull request in a bit! The CI pipeline should then show the diff with the current codebase I guess ;)</p>



<a name="225349315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225349315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bastian <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225349315">(Feb 05 2021 at 20:04)</a>:</h4>
<p><span class="user-mention silent" data-user-id="369415">xFrednet</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467/near/225344049">said</a>:</p>
<blockquote>
<p>Okay, this was probably also the main reason why <span class="user-mention silent" data-user-id="264664">flip1995</span> recommended to have it as a <code>pedantic</code> lint to enable it by default. We might have to think about enabling it for clippy completely. I would be interested in the extend of the lint triggeres in the PR <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>
</blockquote>
<p>Hey, I've just opened the PR here: <a href="https://github.com/rust-lang/rust-clippy/issues/6681">clippy#6681</a> <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>



<a name="225354594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225354594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bastian <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225354594">(Feb 05 2021 at 20:50)</a>:</h4>
<p><span class="user-mention silent" data-user-id="358242">Bastian</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467/near/225349315">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="369415">xFrednet</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467/near/225344049">said</a>:</p>
<blockquote>
<p>Okay, this was probably also the main reason why <span class="user-mention silent" data-user-id="264664">flip1995</span> recommended to have it as a <code>pedantic</code> lint to enable it by default. We might have to think about enabling it for clippy completely. I would be interested in the extend of the lint triggeres in the PR <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>
</blockquote>
<p>Hey, I've just opened the PR here: <a href="https://github.com/rust-lang/rust-clippy/issues/6681">clippy#6681</a> <span aria-label="grinning" class="emoji emoji-1f600" role="img" title="grinning">:grinning:</span></p>
</blockquote>
<p>Arghhh just saw that the lint also fires on loops. I've converted it back to draft and I'm going to fix it tomorrow ;)</p>



<a name="225363172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225363172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225363172">(Feb 05 2021 at 21:57)</a>:</h4>
<p>I think the easiest way to handle all those cases is to check if the snippet of the <code>block.expr.span</code> ends with <code>}</code> and just not lint in this case. if_chain! is definitely a macro where a <code>;</code> at the end just looks weird.</p>



<a name="225363274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225363274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225363274">(Feb 05 2021 at 21:58)</a>:</h4>
<p>So forget my comments about macro checks inside the <code>then</code> from before and do it the hacky way^</p>



<a name="225375916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225375916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225375916">(Feb 06 2021 at 00:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="264664">flip1995</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467/near/225363172">said</a>:</p>
<blockquote>
<p>I think the easiest way to handle all those cases is to check if the snippet of the <code>block.expr.span</code> ends with <code>}</code> and just not lint in this case. if_chain! is definitely a macro where a <code>;</code> at the end just looks weird.</p>
</blockquote>
<p>Is there maybe a simple way to check which brackets a macro uses? All macros that I know of use the common rust conventions of <code>(...)</code> for function like thinks <code>[...]</code> for array like thinks and <code>{...}</code> for block like thinks. Using the macro definition would seem a bit cleaner to me but might not be possible.</p>



<a name="225405609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225405609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bastian <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225405609">(Feb 06 2021 at 11:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="264664">flip1995</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681)/near/225363172">said</a>:</p>
<blockquote>
<p>I think the easiest way to handle all those cases is to check if the snippet of the <code>block.expr.span</code> ends with <code>}</code> and just not lint in this case. if_chain! is definitely a macro where a <code>;</code> at the end just looks weird.</p>
</blockquote>
<p>Ok, that sound good, but apparently I got back to the same issue concerning macro invocations... looking at the <code>println!()</code> macro, at this point the snippet I get when converting the <code>block.expr.span</code> looks like this: <code>"{/n        $crate::io::_print($crate::format_args_nl!($($arg)*));/n    }</code>. So matching on the closing <code>}</code>is kinda difficult.</p>



<a name="225406250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225406250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225406250">(Feb 06 2021 at 11:41)</a>:</h4>
<p>Try calling <code>.source_callsite()</code> on the span. That should give you the actual code that was written :)<br>
-&gt; <code>block.expr.span.source_callsite()</code></p>



<a name="225406488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225406488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bastian <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225406488">(Feb 06 2021 at 11:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="369415">xFrednet</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681)/near/225406250">said</a>:</p>
<blockquote>
<p>Try calling <code>.source_callsite()</code> on the span. That should give you the actual code that was written :)<br>
-&gt; <code>block.expr.span.source_callsite()</code></p>
</blockquote>
<p>Ahh great! That's it <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="225409514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225409514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225409514">(Feb 06 2021 at 12:26)</a>:</h4>
<p>I don't think so. AFAIK it doesn't matter which parentheses you use for a macro call, so the compiler doesn't differentiate between those.</p>



<a name="225410133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225410133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bastian <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225410133">(Feb 06 2021 at 12:42)</a>:</h4>
<p><span class="user-mention silent" data-user-id="264664">flip1995</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681)/near/225409514">said</a>:</p>
<blockquote>
<p>I don't think so. AFAIK it doesn't matter which parentheses you use for a macro call, so the compiler doesn't differentiate between those.</p>
</blockquote>
<p>Yeah that is my experience as well, but imo  a <code>;</code> suits an <code>if_chain!</code> with round brackets pretty well:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">if_chain</span><span class="o">!</span><span class="p">(</span><span class="w"></span>
<span class="w">    </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">foo</span><span class="p">;</span><span class="w"></span>
<span class="p">);</span><span class="w"></span>
</code></pre></div>



<a name="225410203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225410203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225410203">(Feb 06 2021 at 12:44)</a>:</h4>
<p>TIL, I thought each macro defined which parentheses it uses^^</p>



<a name="225410248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225410248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225410248">(Feb 06 2021 at 12:46)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=d8fe41094fc2b107f104aee7782ff110">Nope</a></p>



<a name="225410359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225410359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225410359">(Feb 06 2021 at 12:48)</a>:</h4>
<p>Another test:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="fm">println!</span><span class="p">[</span><span class="s">"{}"</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">];</span><span class="w"></span>
<span class="fm">println!</span><span class="p">{</span><span class="s">"{}"</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">};</span><span class="w"></span>
</code></pre></div>
<p>It works, let's never write this again</p>



<a name="225411569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225411569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bastian <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225411569">(Feb 06 2021 at 13:20)</a>:</h4>
<p>Ok, I think I'm pretty far now with the lint! So my (hopefully) last question: Is there a way to find out (from the HIR), that I'm currently in a macro definition? My lint works pretty good by now but just lints definitions within <code>macro_rules!</code> that are embedded in a double curly bracket like this one:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">error</span>: <span class="nc">add</span><span class="w"> </span><span class="err">`</span><span class="p">;</span><span class="err">`</span><span class="w"> </span><span class="n">to</span><span class="w"> </span><span class="n">terminate</span><span class="w"> </span><span class="n">block</span><span class="w"></span>
<span class="w">  </span><span class="o">-</span>-&gt; <span class="nc">clippy_lints</span><span class="o">/</span><span class="n">src</span><span class="o">/</span><span class="n">double_comparison</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">53</span>:<span class="mi">26</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="mi">53</span><span class="w"> </span><span class="o">|</span><span class="w">               </span><span class="p">(</span><span class="cp">$op</span>:<span class="nc">tt</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{{</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">  </span><span class="n">__________________________</span><span class="o">^</span><span class="w"></span>
<span class="mi">54</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">|</span><span class="w">                 </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">applicability</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Applicability</span>::<span class="n">MachineApplicable</span><span class="p">;</span><span class="w"></span>
<span class="mi">55</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">|</span><span class="w">                 </span><span class="kd">let</span><span class="w"> </span><span class="n">lhs_str</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">snippet_with_applicability</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span><span class="w"> </span><span class="n">llhs</span><span class="p">.</span><span class="n">span</span><span class="p">,</span><span class="w"> </span><span class="s">""</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">applicability</span><span class="p">);</span><span class="w"></span>
<span class="mi">56</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">|</span><span class="w">                 </span><span class="kd">let</span><span class="w"> </span><span class="n">rhs_str</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">snippet_with_applicability</span><span class="p">(</span><span class="n">cx</span><span class="p">,</span><span class="w"> </span><span class="n">lrhs</span><span class="p">.</span><span class="n">span</span><span class="p">,</span><span class="w"> </span><span class="s">""</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">applicability</span><span class="p">);</span><span class="w"></span>
<span class="o">..</span><span class="p">.</span><span class="w">  </span><span class="o">|</span><span class="w"></span>
<span class="mi">66</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">|</span><span class="w">                 </span><span class="p">);</span><span class="w"></span>
<span class="mi">67</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="o">|</span><span class="w">             </span><span class="p">}};</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"> </span><span class="o">|</span><span class="n">_____________</span><span class="o">^</span><span class="w"></span>
</code></pre></div>
<p>I already check for a closing curly bracket in the <code>span.source_callsite()</code>, but it seems like the original callsite somehow differs...</p>



<a name="225411807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225411807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225411807">(Feb 06 2021 at 13:26)</a>:</h4>
<p>I can just guess, but I would say, that you use <code>source_callsite</code> maybe wrong <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="225411969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225411969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bastian <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225411969">(Feb 06 2021 at 13:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="264664">flip1995</span> <a href="#narrow/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681)/near/225411807">said</a>:</p>
<blockquote>
<p>I can just guess, but I would say, that you use <code>source_callsite</code> maybe wrong <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>
</blockquote>
<p>Mh, that's what I thought. I've committed the code to the PR. Should I maybe add a context to the callsite call? Maybe with <code>with_call_site_ctxt</code>?</p>



<a name="225412059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Problems%20with%20issue%20clippy%236467%20%28PR%3A%20clippy%236681%29/near/225412059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> flip1995 <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Problems.20with.20issue.20clippy.236467.20(PR.3A.20clippy.236681).html#225412059">(Feb 06 2021 at 13:32)</a>:</h4>
<p>left some comments</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>